package com.bbjob.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;

import javax.annotation.Resource;

import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.bbjob.dto.Result;
import com.bbjob.model.ExamineeInfo;
import com.bbjob.query.QueryExaminee;
import com.bbjob.service.IExamineeInfoService;

@Api(tags = "examineeInfoApi", description = "应试人员管理")
@RestController
@RequestMapping(path = "examineeInfo", produces = "application/json;charset=utf-8")
public class ExamineeInfoController {
	
	@Resource
	private IExamineeInfoService examineeInfoService;
	
	@ApiOperation(value="应试人员录入", notes="应试人员录入")
	@ApiImplicitParam(name="examineeInfo", value="应试人员录入", required=true, dataType="ExamineeInfo")
	@RequestMapping(value="entry", method=RequestMethod.POST)
	public Result entryExaminee(@RequestBody ExamineeInfo examineeInfo) {
		
		return examineeInfoService.entryInfo(examineeInfo);
	}

	

	@ApiOperation(value="应试人员列表", notes="应试人员列表")
	@ApiImplicitParam(name="examinee", value="应试人员信息", required=true, dataType="QueryExaminee")
	@RequestMapping(value="list", method=RequestMethod.POST)
	public Result list(@RequestBody QueryExaminee examinee) {
		
		// List<SysOrganizationStu> data = examineeService.selectByParams(examinee);
		
		// PageInfo<SysOrganizationStu> pageInfo = ; //new PageInfo<SysOrganizationStu>(data);
		return examineeInfoService.selectByParams(examinee);
	}
	
	@ApiOperation(value="应试人员信息", notes="应试人员信息")
	@ApiImplicitParam(name="id", value="应试人员信息id", required=true, dataType="Integer", paramType="path")
	@RequestMapping(value="get/{id}", method=RequestMethod.GET)
	public Result get(@PathVariable("id")Integer id) {
		
		
		return examineeInfoService.selectByPrimaryKey(id);
	}
	
	@ApiOperation(value="修改应试人员", notes="修改应试人员")
	@ApiImplicitParams({
			@ApiImplicitParam(name="id", value="应试人员id", required=true, dataType="Integer", paramType="path"),
			@ApiImplicitParam(name="examineeInfo", value="应试人员信息", required=true, dataType="ExamineeInfo")	
	})
	@RequestMapping(value="edit/{id}", method=RequestMethod.POST)
	public Result edit(@PathVariable("id")Integer id, @RequestBody ExamineeInfo examineeInfo) {
		
		examineeInfo.setId(id);
		
		// this.examineeInfoService.updateStudent(examineeInfo, id);
		
		return examineeInfoService.updateStudent(examineeInfo, id);
	}
	
	@ApiOperation(value="删除应试人员", notes="删除应试人员")
	@ApiImplicitParam(name="id", value="应试人员id", required=true, dataType="Integer", paramType="path")
	@RequestMapping(value="del/{id}", method=RequestMethod.GET)
	public Result del(@PathVariable("id")Integer id) {
		
		examineeInfoService.delById(id);
		
		return new Result();
	}
	
}
